'''
@Project ：hdcms-scripts
@File    ：test.py
@IDE     ：PyCharm
@Author  ：朱广杰
@Date    ：2024/11/12 12:52
'''
from common.FILE_PATH import load_yaml_file, write_yaml, BASE_DIR
import pytest

content = load_yaml_file('/config/common.yml')
params = {'chat_room_id': 133437, 'course_id': 'b2dfa8ff218d3e1258395274049e188e','zuser_id': '374a2b4762b7938337af9ddec0a3218a'}
content.update(params)

write_yaml('/config/common.yml', content)
print(load_yaml_file('/config/common.yml'))

try:
    test_file = f'{BASE_DIR}/script/test_dhy_room_grouping.py'
    print(test_file)
    # pytest_result = pytest.main(['-v', '-s', f'{BASE_DIR}/script/test_dhy_room_grouping.py'])
    pytest_result = pytest.main(['-v', '-s', test_file])

    # if pytest_result == pytest.ExitCode.OK:
    #     data = pytest_result
    #     print(pytest_result)
#
#     raise Exception(f'pytest 脚本执行失败，{pytest_result}')
except Exception as e:
    raise Exception(f'执行脚本失败，失败原因为{e}')
